#!/bin/bash
# date: Mon Aug  1 09:57:20 CST 2022
# author: xxr
read -p "输入用户名: " username

id $username &> /dev/null
if [ $? -eq 0 ];then
	echo -e "\e[32m${username}用户已存在\e[0m"
else
	useradd $username
	echo "$username" | passwd --stdin $username &> /dev/null
	echo -e "\e[32m${username}用户已创建，且默认密码为用户名\e[0m"
fi

